package main

import (
	"fmt"
	"sync"
)

type Student struct {
	name string
}

func main() {
	fmt.Println("hello word")
	fmt.Println(add(1, 2))
	list := make([]Student, 0, 10)
	hchan := make(chan Student, 4)
	group := sync.WaitGroup{}
	group.Add(10)
	go func() {
		for {
			select {
			case content := <-hchan:
				fmt.Println("1:%s", content.name)
				content.name = "1111111"
				group.Done()
			}
		}
	}()

	go func() {
		for {
			select {
			case content := <-hchan:
				fmt.Println("2:%s", content.name)
				content.name = "1111111"
				group.Done()
			}
		}
	}()
	for i := 0; i < 10; i++ {
		st := Student{
			name: string(i),
		}
		hchan <- st
		list = append(list, st)
	}
	group.Wait()

}

func add(a int, b int) int {
	return a + b
}
